-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add python wrapper for sequence_pool #6787
Conversation
avg_x = fluid.layers.sequence_pool(input=x, pool_type='average') | ||
sum_x = fluid.layers.sequence_pool(input=x, pool_type='sum') | ||
sqrt_x = fluid.layers.sequence_pool(input=x, pool_type='sqrt') | ||
max_x = fluid.layers.sequence_pool(input=x, pool_type='max') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to limit the type in (average/sum/sqrt/max)?
If so, I think it's better to add a check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I limit the type in (average/sum/sqrt/max), then sequence_first_step should not be
def sequence_first_step(input, **kwargs):
return sequence_pool(input=input, pool_type="first")
It should be
def sequence_first_step(input, **kwargs):
helper = LayerHelper('sequence_pool', input=input, **kwargs)
dtype = helper.input_dtype()
pool_out = helper.create_tmp_variable(dtype)
max_index = helper.create_tmp_variable(dtype)
helper.append_op(
type="sequence_pool",
inputs={"X": input},
outputs={"Out": pool_out,
"MaxIndex": max_index},
attrs={"pooltype": "first"})
return pool_out
but max_index = helper.create_tmp_variable(dtype)
could not be removed. If we want to remove it, we should add an single sequence_max_op.cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great Job
fix #6777
The generated sequence_pool website is :